<template>
  <div>
    <div class="flex items-center">
      <!-- <span>版本列表</span> -->
      <el-button type="primary" @click="onAdd">添加频道</el-button>
    </div>
    <el-table class="mt-2" stripe v-loading="loading" :data="rows">
      <!-- <el-table-column prop="id" label="ID" width="180"> </el-table-column> -->

      <el-table-column type="index" label="序号" width="60"> </el-table-column>
      <el-table-column prop="name" label="名称"> </el-table-column>
      <el-table-column prop="cid" label="频道ID"> </el-table-column>
      <el-table-column prop="owner" label="所有者"> </el-table-column>
      <el-table-column prop="desc" label="描述信息"> </el-table-column>
      <el-table-column prop="callback" label="回调函数"> </el-table-column>
      <el-table-column prop="from" label="头像">
        <template slot-scope="{ row }">
          <img :src="row.portrait" class="w-8 h-8 rounded-full" />
        </template>
      </el-table-column>

      <el-table-column label="操作" width="160">
        <template slot-scope="{ row }">
          <el-button
            type="primary"
            icon="el-icon-edit"
            circle
            @click="onEdit(row)"
          ></el-button>
        </template>
      </el-table-column>
    </el-table>
    <this-add ref="add" @added="fetch" />
    <this-edit ref="edit" @edited="fetch" />
    <the-page ref="page" @change="fetch" />
  </div>
</template>

<script>
import rowsCurl from "@/mixins/rows-curl";
import thePage from "@/components/page.vue";
import thisAdd from "./add.vue";
import thisEdit from "./edit.vue";

export default {
  components: { thisAdd, thePage, thisEdit },
  mixins: [rowsCurl],
  data() {
    return {
      uri: {
        list: "channel/list",
      },
      targetName: "",
    };
  },
  computed: {},
  methods: {
    toggleBand(row, status) {
      this.axios
        .post("/user/updateUserStatus", {
          status,
          userId: row.uid,
        })
        .then((res) => {
          if (res.retCode != 0) {
            return this.$message.error(res.retMsg);
          }
          this.fetch(1);
          this.$message.success("操作成功!");
          // this.loading = false;
        });
    },
  },
};
</script>

<style>
</style>